Termination w.r.t. Q of the following Term Rewriting System could be proven:

Q restricted rewrite system:
The TRS R consists of the following rules:

filter(cons(X, Y), 0, M) → cons(0, n__filter(activate(Y), M, M))
filter(cons(X, Y), s(N), M) → cons(X, n__filter(activate(Y), N, M))
sieve(cons(0, Y)) → cons(0, n__sieve(activate(Y)))
sieve(cons(s(N), Y)) → cons(s(N), n__sieve(filter(activate(Y), N, N)))
nats(N) → cons(N, n__nats(s(N)))
zprimessieve(nats(s(s(0))))
filter(X1, X2, X3) → n__filter(X1, X2, X3)
sieve(X) → n__sieve(X)
nats(X) → n__nats(X)
activate(n__filter(X1, X2, X3)) → filter(X1, X2, X3)
activate(n__sieve(X)) → sieve(X)
activate(n__nats(X)) → nats(X)
activate(X) → X

Q is empty.


QTRS
  ↳ DependencyPairsProof

Q restricted rewrite system:
The TRS R consists of the following rules:

filter(cons(X, Y), 0, M) → cons(0, n__filter(activate(Y), M, M))
filter(cons(X, Y), s(N), M) → cons(X, n__filter(activate(Y), N, M))
sieve(cons(0, Y)) → cons(0, n__sieve(activate(Y)))
sieve(cons(s(N), Y)) → cons(s(N), n__sieve(filter(activate(Y), N, N)))
nats(N) → cons(N, n__nats(s(N)))
zprimessieve(nats(s(s(0))))
filter(X1, X2, X3) → n__filter(X1, X2, X3)
sieve(X) → n__sieve(X)
nats(X) → n__nats(X)
activate(n__filter(X1, X2, X3)) → filter(X1, X2, X3)
activate(n__sieve(X)) → sieve(X)
activate(n__nats(X)) → nats(X)
activate(X) → X

Q is empty.

Using Dependency Pairs [1,15] we result in the following initial DP problem:
Q DP problem:
The TRS P consists of the following rules:

FILTER(cons(X, Y), 0, M) → ACTIVATE(Y)
ACTIVATE(n__filter(X1, X2, X3)) → FILTER(X1, X2, X3)
SIEVE(cons(0, Y)) → ACTIVATE(Y)
ZPRIMESSIEVE(nats(s(s(0))))
ZPRIMESNATS(s(s(0)))
ACTIVATE(n__sieve(X)) → SIEVE(X)
SIEVE(cons(s(N), Y)) → FILTER(activate(Y), N, N)
ACTIVATE(n__nats(X)) → NATS(X)
FILTER(cons(X, Y), s(N), M) → ACTIVATE(Y)
SIEVE(cons(s(N), Y)) → ACTIVATE(Y)

The TRS R consists of the following rules:

filter(cons(X, Y), 0, M) → cons(0, n__filter(activate(Y), M, M))
filter(cons(X, Y), s(N), M) → cons(X, n__filter(activate(Y), N, M))
sieve(cons(0, Y)) → cons(0, n__sieve(activate(Y)))
sieve(cons(s(N), Y)) → cons(s(N), n__sieve(filter(activate(Y), N, N)))
nats(N) → cons(N, n__nats(s(N)))
zprimessieve(nats(s(s(0))))
filter(X1, X2, X3) → n__filter(X1, X2, X3)
sieve(X) → n__sieve(X)
nats(X) → n__nats(X)
activate(n__filter(X1, X2, X3)) → filter(X1, X2, X3)
activate(n__sieve(X)) → sieve(X)
activate(n__nats(X)) → nats(X)
activate(X) → X

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

↳ QTRS
  ↳ DependencyPairsProof
QDP
      ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

FILTER(cons(X, Y), 0, M) → ACTIVATE(Y)
ACTIVATE(n__filter(X1, X2, X3)) → FILTER(X1, X2, X3)
SIEVE(cons(0, Y)) → ACTIVATE(Y)
ZPRIMESSIEVE(nats(s(s(0))))
ZPRIMESNATS(s(s(0)))
ACTIVATE(n__sieve(X)) → SIEVE(X)
SIEVE(cons(s(N), Y)) → FILTER(activate(Y), N, N)
ACTIVATE(n__nats(X)) → NATS(X)
FILTER(cons(X, Y), s(N), M) → ACTIVATE(Y)
SIEVE(cons(s(N), Y)) → ACTIVATE(Y)

The TRS R consists of the following rules:

filter(cons(X, Y), 0, M) → cons(0, n__filter(activate(Y), M, M))
filter(cons(X, Y), s(N), M) → cons(X, n__filter(activate(Y), N, M))
sieve(cons(0, Y)) → cons(0, n__sieve(activate(Y)))
sieve(cons(s(N), Y)) → cons(s(N), n__sieve(filter(activate(Y), N, N)))
nats(N) → cons(N, n__nats(s(N)))
zprimessieve(nats(s(s(0))))
filter(X1, X2, X3) → n__filter(X1, X2, X3)
sieve(X) → n__sieve(X)
nats(X) → n__nats(X)
activate(n__filter(X1, X2, X3)) → filter(X1, X2, X3)
activate(n__sieve(X)) → sieve(X)
activate(n__nats(X)) → nats(X)
activate(X) → X

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 3 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
QDP
          ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

FILTER(cons(X, Y), 0, M) → ACTIVATE(Y)
ACTIVATE(n__filter(X1, X2, X3)) → FILTER(X1, X2, X3)
SIEVE(cons(0, Y)) → ACTIVATE(Y)
SIEVE(cons(s(N), Y)) → FILTER(activate(Y), N, N)
ACTIVATE(n__sieve(X)) → SIEVE(X)
FILTER(cons(X, Y), s(N), M) → ACTIVATE(Y)
SIEVE(cons(s(N), Y)) → ACTIVATE(Y)

The TRS R consists of the following rules:

filter(cons(X, Y), 0, M) → cons(0, n__filter(activate(Y), M, M))
filter(cons(X, Y), s(N), M) → cons(X, n__filter(activate(Y), N, M))
sieve(cons(0, Y)) → cons(0, n__sieve(activate(Y)))
sieve(cons(s(N), Y)) → cons(s(N), n__sieve(filter(activate(Y), N, N)))
nats(N) → cons(N, n__nats(s(N)))
zprimessieve(nats(s(s(0))))
filter(X1, X2, X3) → n__filter(X1, X2, X3)
sieve(X) → n__sieve(X)
nats(X) → n__nats(X)
activate(n__filter(X1, X2, X3)) → filter(X1, X2, X3)
activate(n__sieve(X)) → sieve(X)
activate(n__nats(X)) → nats(X)
activate(X) → X

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


ACTIVATE(n__sieve(X)) → SIEVE(X)
The remaining pairs can at least be oriented weakly.

FILTER(cons(X, Y), 0, M) → ACTIVATE(Y)
ACTIVATE(n__filter(X1, X2, X3)) → FILTER(X1, X2, X3)
SIEVE(cons(0, Y)) → ACTIVATE(Y)
SIEVE(cons(s(N), Y)) → FILTER(activate(Y), N, N)
FILTER(cons(X, Y), s(N), M) → ACTIVATE(Y)
SIEVE(cons(s(N), Y)) → ACTIVATE(Y)
Used ordering: Polynomial interpretation [25]:

POL(0) = 0   
POL(ACTIVATE(x1)) = x1   
POL(FILTER(x1, x2, x3)) = x1   
POL(SIEVE(x1)) = x1   
POL(activate(x1)) = x1   
POL(cons(x1, x2)) = x2   
POL(filter(x1, x2, x3)) = x1   
POL(n__filter(x1, x2, x3)) = x1   
POL(n__nats(x1)) = 0   
POL(n__sieve(x1)) = 1 + x1   
POL(nats(x1)) = 0   
POL(s(x1)) = 0   
POL(sieve(x1)) = 1 + x1   

The following usable rules [17] were oriented:

filter(cons(X, Y), 0, M) → cons(0, n__filter(activate(Y), M, M))
filter(cons(X, Y), s(N), M) → cons(X, n__filter(activate(Y), N, M))
nats(N) → cons(N, n__nats(s(N)))
sieve(cons(0, Y)) → cons(0, n__sieve(activate(Y)))
sieve(cons(s(N), Y)) → cons(s(N), n__sieve(filter(activate(Y), N, N)))
nats(X) → n__nats(X)
activate(n__filter(X1, X2, X3)) → filter(X1, X2, X3)
filter(X1, X2, X3) → n__filter(X1, X2, X3)
sieve(X) → n__sieve(X)
activate(X) → X
activate(n__sieve(X)) → sieve(X)
activate(n__nats(X)) → nats(X)



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ QDPOrderProof
QDP
              ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

FILTER(cons(X, Y), 0, M) → ACTIVATE(Y)
ACTIVATE(n__filter(X1, X2, X3)) → FILTER(X1, X2, X3)
SIEVE(cons(0, Y)) → ACTIVATE(Y)
SIEVE(cons(s(N), Y)) → FILTER(activate(Y), N, N)
FILTER(cons(X, Y), s(N), M) → ACTIVATE(Y)
SIEVE(cons(s(N), Y)) → ACTIVATE(Y)

The TRS R consists of the following rules:

filter(cons(X, Y), 0, M) → cons(0, n__filter(activate(Y), M, M))
filter(cons(X, Y), s(N), M) → cons(X, n__filter(activate(Y), N, M))
sieve(cons(0, Y)) → cons(0, n__sieve(activate(Y)))
sieve(cons(s(N), Y)) → cons(s(N), n__sieve(filter(activate(Y), N, N)))
nats(N) → cons(N, n__nats(s(N)))
zprimessieve(nats(s(s(0))))
filter(X1, X2, X3) → n__filter(X1, X2, X3)
sieve(X) → n__sieve(X)
nats(X) → n__nats(X)
activate(n__filter(X1, X2, X3)) → filter(X1, X2, X3)
activate(n__sieve(X)) → sieve(X)
activate(n__nats(X)) → nats(X)
activate(X) → X

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 3 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ QDPOrderProof
            ↳ QDP
              ↳ DependencyGraphProof
QDP
                  ↳ UsableRulesProof

Q DP problem:
The TRS P consists of the following rules:

FILTER(cons(X, Y), 0, M) → ACTIVATE(Y)
ACTIVATE(n__filter(X1, X2, X3)) → FILTER(X1, X2, X3)
FILTER(cons(X, Y), s(N), M) → ACTIVATE(Y)

The TRS R consists of the following rules:

filter(cons(X, Y), 0, M) → cons(0, n__filter(activate(Y), M, M))
filter(cons(X, Y), s(N), M) → cons(X, n__filter(activate(Y), N, M))
sieve(cons(0, Y)) → cons(0, n__sieve(activate(Y)))
sieve(cons(s(N), Y)) → cons(s(N), n__sieve(filter(activate(Y), N, N)))
nats(N) → cons(N, n__nats(s(N)))
zprimessieve(nats(s(s(0))))
filter(X1, X2, X3) → n__filter(X1, X2, X3)
sieve(X) → n__sieve(X)
nats(X) → n__nats(X)
activate(n__filter(X1, X2, X3)) → filter(X1, X2, X3)
activate(n__sieve(X)) → sieve(X)
activate(n__nats(X)) → nats(X)
activate(X) → X

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We can use the usable rules and reduction pair processor [15] with the Ce-compatible extension of the polynomial order that maps every function symbol to the sum of its argument. Then, we can delete all non-usable rules [17] from R.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ QDPOrderProof
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ UsableRulesProof
QDP
                      ↳ QDPSizeChangeProof

Q DP problem:
The TRS P consists of the following rules:

FILTER(cons(X, Y), 0, M) → ACTIVATE(Y)
ACTIVATE(n__filter(X1, X2, X3)) → FILTER(X1, X2, X3)
FILTER(cons(X, Y), s(N), M) → ACTIVATE(Y)

R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: